#pragma once

#include "KKComm.h"
#include <string>
#include <vector>

// 对 skia2 和 cairo 基础绘制功能的抽象
// 包含类型的定义

class KKRenderI
{
  public:
    virtual bool Init(void *handle) = 0;
    virtual void Release() = 0;
    virtual bool IsReady() = 0;

    virtual void Clear(KKColor color) = 0;
    virtual void SetFont(std::string font_name, int font_size, int font_style) = 0;
    virtual void SetColor(KKColor color) = 0;
    virtual void SetLinearGradientColor(KKPoint start, KKPoint end, KKColor start_color, KKColor end_color) = 0;

    virtual void SetLineStyle(int style, int arg1 = 0, int arg2 = 0) = 0;
    virtual void SetLineWidth(double width) = 0;
    virtual void SetLineCap(int cap) = 0;
    virtual void SetLineJoin(int join) = 0;

    virtual void DrawLine(KKPoint start, KKPoint end) = 0;
    // 角度单位为度，逆时针方向旋转
    virtual void DrawArc(KKRect rect, double start_angle, double sweep_angle) = 0;

    virtual void DrawRect(KKRect rect, bool is_fill = false) = 0;
    virtual void DrawRoundRect(KKRect rect, int radius, bool is_fill = false) = 0;
    virtual void DrawCircle(KKPoint center, int radius, bool is_fill = false) = 0;
    virtual void DrawPolygon(std::vector<KKPoint> points, bool is_fill = false) = 0;
    virtual void DrawRect2(KKRect rect, KKSpace width, KKSpaceColor color, KKSpace line_style) = 0;
    virtual void DrawText(std::string text, KKRect rect, KK_TEXT_ALIGN alignX = KK_TEXT_ALIGN_LEFT,
                          KK_TEXT_ALIGN alignY = KK_TEXT_ALIGN_CENTER) = 0; // 绘制utf8文本
    virtual void DrawText(std::string text, KKPoint pos) = 0;               // 绘制utf8文本

    virtual void DrawImage(std::string path, KKRect rect, KK_IMAGE_FIT fit = KK_IMAGE_FIT_FILL) = 0;
    virtual void DrawImageBorder(std::string path, KKRect dest, KKSpace space) = 0;

    // font
    virtual std::string GetCurFontFamily() = 0;
    virtual int GetCurFontSize() = 0;
    virtual int GetCurFontStyle() = 0;
};